<?php

namespace app\store\model;

use app\common\model\Division as DivisionModel;
class Division extends DivisionModel
{
    /**
     * 获取列表
     * @return \think\Paginator
     * @throws \think\exception\DbException
     */
    public function getList()
    {
        return $this->order(['create_time' => 'desc'])
            ->paginate(15, false, [
                'query' => request()->request()
            ]);

    }
    /**
     * 新增记录
     * @param $data
     * @return false|int
     */
    public function add($data)
    {
        //$data['wxapp_id'] = self::$wxapp_id;
        return $this->allowField(true)->save($data);
    }
    /**
     * 更新记录
     * @param $data
     * @return bool|int
     */
    public function edit($data,$id)
    {
        return $this->allowField(true)->save($data,['id'=>$id]) !== false;
    }
    /**
     * 删除文章
     * @param $article_id
     * @return array
     * @throws \think\exception\DbException
     */
    public static function del($id)
    {
        return self::destroy($id);
    }
}